package com.demo;

import com.demo.config.SpringHintLoadBalancerConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * 测试链接：<a href="http://localhost:8763/service/info">http://localhost:8763/service/info</a>
 * swagger: <a href="http://localhost:8763/swagger-ui/index.html">http://localhost:8763/swagger-ui/index.html</a>
 * graylog: <a href="http://127.0.0.1:9000">http://127.0.0.1:9000</a>
 *
 * spring-boot-starter-data-elasticsearch 4.0.6.RELEASE版本需要使用注解 @EnableElasticsearchRepositories
 *
 * 注解EnableFeignClients从第三方jar加载FeignClient和本地FeignClient
 *
 * 注解LoadBalancerClients指定调用的服务使用灰度均衡器和全局使用灰度均衡器
 * @author K
 */
@Slf4j
@EnableElasticsearchRepositories
@EnableAsync
@ServletComponentScan
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients({"com.demo.miya.controller.client"})
@MapperScan("com.demo.dao.mapper")
//@LoadBalancerClients(@LoadBalancerClient(name = "service-miya", configuration = GrayLoadBalancerConfig.class))
@LoadBalancerClients(defaultConfiguration = SpringHintLoadBalancerConfiguration.class)
public class ServiceLunaApplication {
	public static void main(String[] args) {
		log.debug("service-luna startup............................................");
		SpringApplication.run(ServiceLunaApplication.class, args);
	}
}
